<template>
    <a-form-model :label-col="{ span: 4 }" :wrapper-col="{ span: 12 }">
        <a-form-model-item label="自动提现开关">
            <a-switch  v-model="info.switch" />
        </a-form-model-item>
<!--        <a-form-model-item label="提现手续费">-->
<!--            <a-input type="number" v-model="info.service_charge" suffix="%"></a-input>-->
<!--        </a-form-model-item>-->
        <a-form-model-item :wrapper-col="{ span: 12, offset: 4 }">
            <a-button type="primary" @click="handleSubmit">提交</a-button>
        </a-form-model-item>
    </a-form-model>
</template>

<script>
export default {
    data() {
      return {
          info:{
          },
      };
    },
    methods: {
        handleSubmit(){
            this.$post(this.$api.adminConfigs,{flea_withdrawal: JSON.stringify(this.info)}).then(res=>{
                if(res.code == 200){
                    this.$message.success(res.msg)
                    return this.onload();
                }else{
                    return this.$message.error(res.msg)
                }
            })
        },
        get_info(){
            this.$get(this.$api.adminConfigs).then(res=>{
                this.info = res.data.flea_withdrawal;
            })
        },
        // 获取列表
        onload(){
            this.get_info();
        },

    },
    created() {
        this.onload();
    },
};
</script>
